package com.mediocre.customLogin.controller;

import com.mediocre.customLogin.model.User;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    /**
     * @desc 松哥手把手带你捋一遍 Spring Security 登录流程
     *
     * @param authentication
     * @return com.mediocre.withjpa.model.User
     * @author 张伟
     * @date 2022/1/2
     * @modifier
     */
    @GetMapping("/user/currUserInfo")
    public User getCurrUserInfo(Authentication authentication) {
        return (User) authentication.getPrincipal();
    }
}
